package com.hs.sfzy.controller;

import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.Psych;
import com.hs.sfzy.entity.PsychKnow;
import com.hs.sfzy.service.PsychKnowService;
import com.hs.sfzy.service.PsychService;
import com.hs.sfzy.until.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("psychKnow")
public class PsychKnowController {
    @Autowired
    private PsychKnowService psychKnowService;

    @GetMapping("page")
    public R getAllPsychKnow(PsychKnow psychKnow, @RequestParam(required = false,defaultValue = "1") int pageNum,
                             @RequestParam(required = false,defaultValue = "5") int pageSize) {
        PageInfo<PsychKnow> all = psychKnowService.getAll(psychKnow, pageNum, pageSize);
        return R.ok(all);

    }
    @GetMapping("{id}")
    public R getPsychKnowById(@PathVariable("id") int id) {
        PsychKnow psychKnow = psychKnowService.getById(id);
        return R.ok(psychKnow);
    }
//    @GetMapping("page")
//    public R getAllPsychKnow(PsychKnow psychKnow,int pageNum,int pageSize) {
//        PageInfo<Psych> psychPageInfo = psychService.selectAll(psychKnow,pageSize,pageNum);
//        return R.ok(psychPageInfo);
//    }
}
